﻿#region Using directives

using System;
using System.Data;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;

using BesAsm.MasterData.Entities;
using BesAsm.MasterData.Data;

#endregion

namespace BesAsm.MasterData.Data.Bases
{	
	///<summary>
	/// This class is the base class for any <see cref="PumpProviderBase"/> implementation.
	/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
	///</summary>
	public abstract partial class PumpProviderBaseCore : EntityProviderBase<BesAsm.MasterData.Entities.Pump, BesAsm.MasterData.Entities.PumpKey>
	{		
		#region Get from Many To Many Relationship Functions
		#endregion	
		
		#region Delete Methods

		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to delete.</param>
		/// <returns>Returns true if operation suceeded.</returns>
		public override bool Delete(TransactionManager transactionManager, BesAsm.MasterData.Entities.PumpKey key)
		{
			return Delete(transactionManager, key.PumpId);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="_pumpId">Primary key. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public bool Delete(System.Int32 _pumpId)
		{
			return Delete(null, _pumpId);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_pumpId">Primary key. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public abstract bool Delete(TransactionManager transactionManager, System.Int32 _pumpId);		
		
		#endregion Delete Methods
		
		#region Get By Foreign Key Functions
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_LINKS key.
		///		FK_PUMPS_LINKS Description: 
		/// </summary>
		/// <param name="_linkId">Associate link being modified</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public TList<Pump> GetByLinkId(System.Int32? _linkId)
		{
			int count = -1;
			return GetByLinkId(_linkId, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_LINKS key.
		///		FK_PUMPS_LINKS Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_linkId">Associate link being modified</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		/// <remarks></remarks>
		public TList<Pump> GetByLinkId(TransactionManager transactionManager, System.Int32? _linkId)
		{
			int count = -1;
			return GetByLinkId(transactionManager, _linkId, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_LINKS key.
		///		FK_PUMPS_LINKS Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_linkId">Associate link being modified</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public TList<Pump> GetByLinkId(TransactionManager transactionManager, System.Int32? _linkId, int start, int pageLength)
		{
			int count = -1;
			return GetByLinkId(transactionManager, _linkId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_LINKS key.
		///		fkPumpsLinks Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_linkId">Associate link being modified</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public TList<Pump> GetByLinkId(System.Int32? _linkId, int start, int pageLength)
		{
			int count =  -1;
			return GetByLinkId(null, _linkId, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_LINKS key.
		///		fkPumpsLinks Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_linkId">Associate link being modified</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public TList<Pump> GetByLinkId(System.Int32? _linkId, int start, int pageLength,out int count)
		{
			return GetByLinkId(null, _linkId, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_LINKS key.
		///		FK_PUMPS_LINKS Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_linkId">Associate link being modified</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public abstract TList<Pump> GetByLinkId(TransactionManager transactionManager, System.Int32? _linkId, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_NODES_DS key.
		///		FK_PUMPS_NODES_DS Description: 
		/// </summary>
		/// <param name="_dsNodeId">Foreign key to NODES. Downstream node id.</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public TList<Pump> GetByDsNodeId(System.Int32? _dsNodeId)
		{
			int count = -1;
			return GetByDsNodeId(_dsNodeId, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_NODES_DS key.
		///		FK_PUMPS_NODES_DS Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_dsNodeId">Foreign key to NODES. Downstream node id.</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		/// <remarks></remarks>
		public TList<Pump> GetByDsNodeId(TransactionManager transactionManager, System.Int32? _dsNodeId)
		{
			int count = -1;
			return GetByDsNodeId(transactionManager, _dsNodeId, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_NODES_DS key.
		///		FK_PUMPS_NODES_DS Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_dsNodeId">Foreign key to NODES. Downstream node id.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public TList<Pump> GetByDsNodeId(TransactionManager transactionManager, System.Int32? _dsNodeId, int start, int pageLength)
		{
			int count = -1;
			return GetByDsNodeId(transactionManager, _dsNodeId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_NODES_DS key.
		///		fkPumpsNodesDs Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_dsNodeId">Foreign key to NODES. Downstream node id.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public TList<Pump> GetByDsNodeId(System.Int32? _dsNodeId, int start, int pageLength)
		{
			int count =  -1;
			return GetByDsNodeId(null, _dsNodeId, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_NODES_DS key.
		///		fkPumpsNodesDs Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_dsNodeId">Foreign key to NODES. Downstream node id.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public TList<Pump> GetByDsNodeId(System.Int32? _dsNodeId, int start, int pageLength,out int count)
		{
			return GetByDsNodeId(null, _dsNodeId, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_NODES_DS key.
		///		FK_PUMPS_NODES_DS Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_dsNodeId">Foreign key to NODES. Downstream node id.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public abstract TList<Pump> GetByDsNodeId(TransactionManager transactionManager, System.Int32? _dsNodeId, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_NODES_US key.
		///		FK_PUMPS_NODES_US Description: 
		/// </summary>
		/// <param name="_usNodeId">Foreign key to NODES. Upstream node ID</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public TList<Pump> GetByUsNodeId(System.Int32 _usNodeId)
		{
			int count = -1;
			return GetByUsNodeId(_usNodeId, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_NODES_US key.
		///		FK_PUMPS_NODES_US Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_usNodeId">Foreign key to NODES. Upstream node ID</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		/// <remarks></remarks>
		public TList<Pump> GetByUsNodeId(TransactionManager transactionManager, System.Int32 _usNodeId)
		{
			int count = -1;
			return GetByUsNodeId(transactionManager, _usNodeId, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_NODES_US key.
		///		FK_PUMPS_NODES_US Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_usNodeId">Foreign key to NODES. Upstream node ID</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public TList<Pump> GetByUsNodeId(TransactionManager transactionManager, System.Int32 _usNodeId, int start, int pageLength)
		{
			int count = -1;
			return GetByUsNodeId(transactionManager, _usNodeId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_NODES_US key.
		///		fkPumpsNodesUs Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_usNodeId">Foreign key to NODES. Upstream node ID</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public TList<Pump> GetByUsNodeId(System.Int32 _usNodeId, int start, int pageLength)
		{
			int count =  -1;
			return GetByUsNodeId(null, _usNodeId, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_NODES_US key.
		///		fkPumpsNodesUs Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_usNodeId">Foreign key to NODES. Upstream node ID</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public TList<Pump> GetByUsNodeId(System.Int32 _usNodeId, int start, int pageLength,out int count)
		{
			return GetByUsNodeId(null, _usNodeId, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_NODES_US key.
		///		FK_PUMPS_NODES_US Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_usNodeId">Foreign key to NODES. Upstream node ID</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public abstract TList<Pump> GetByUsNodeId(TransactionManager transactionManager, System.Int32 _usNodeId, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_PUMP_TYPES key.
		///		FK_PUMPS_PUMP_TYPES Description: 
		/// </summary>
		/// <param name="_pumpType">Type of pump</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public TList<Pump> GetByPumpType(System.Int32 _pumpType)
		{
			int count = -1;
			return GetByPumpType(_pumpType, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_PUMP_TYPES key.
		///		FK_PUMPS_PUMP_TYPES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_pumpType">Type of pump</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		/// <remarks></remarks>
		public TList<Pump> GetByPumpType(TransactionManager transactionManager, System.Int32 _pumpType)
		{
			int count = -1;
			return GetByPumpType(transactionManager, _pumpType, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_PUMP_TYPES key.
		///		FK_PUMPS_PUMP_TYPES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_pumpType">Type of pump</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public TList<Pump> GetByPumpType(TransactionManager transactionManager, System.Int32 _pumpType, int start, int pageLength)
		{
			int count = -1;
			return GetByPumpType(transactionManager, _pumpType, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_PUMP_TYPES key.
		///		fkPumpsPumpTypes Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_pumpType">Type of pump</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public TList<Pump> GetByPumpType(System.Int32 _pumpType, int start, int pageLength)
		{
			int count =  -1;
			return GetByPumpType(null, _pumpType, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_PUMP_TYPES key.
		///		fkPumpsPumpTypes Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_pumpType">Type of pump</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public TList<Pump> GetByPumpType(System.Int32 _pumpType, int start, int pageLength,out int count)
		{
			return GetByPumpType(null, _pumpType, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_PUMP_TYPES key.
		///		FK_PUMPS_PUMP_TYPES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_pumpType">Type of pump</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public abstract TList<Pump> GetByPumpType(TransactionManager transactionManager, System.Int32 _pumpType, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_STATUSES key.
		///		FK_PUMPS_STATUSES Description: 
		/// </summary>
		/// <param name="_status">Status of record, in terms of usability for further analysis and general state of data</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public TList<Pump> GetByStatus(System.String _status)
		{
			int count = -1;
			return GetByStatus(_status, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_STATUSES key.
		///		FK_PUMPS_STATUSES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_status">Status of record, in terms of usability for further analysis and general state of data</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		/// <remarks></remarks>
		public TList<Pump> GetByStatus(TransactionManager transactionManager, System.String _status)
		{
			int count = -1;
			return GetByStatus(transactionManager, _status, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_STATUSES key.
		///		FK_PUMPS_STATUSES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_status">Status of record, in terms of usability for further analysis and general state of data</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public TList<Pump> GetByStatus(TransactionManager transactionManager, System.String _status, int start, int pageLength)
		{
			int count = -1;
			return GetByStatus(transactionManager, _status, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_STATUSES key.
		///		fkPumpsStatuses Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_status">Status of record, in terms of usability for further analysis and general state of data</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public TList<Pump> GetByStatus(System.String _status, int start, int pageLength)
		{
			int count =  -1;
			return GetByStatus(null, _status, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_STATUSES key.
		///		fkPumpsStatuses Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_status">Status of record, in terms of usability for further analysis and general state of data</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public TList<Pump> GetByStatus(System.String _status, int start, int pageLength,out int count)
		{
			return GetByStatus(null, _status, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PUMPS_STATUSES key.
		///		FK_PUMPS_STATUSES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_status">Status of record, in terms of usability for further analysis and general state of data</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Pump objects.</returns>
		public abstract TList<Pump> GetByStatus(TransactionManager transactionManager, System.String _status, int start, int pageLength, out int count);
		
		#endregion

		#region Get By Index Functions
		
		/// <summary>
		/// 	Gets a row from the DataSource based on its primary key.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to retrieve.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <returns>Returns an instance of the Entity class.</returns>
		public override BesAsm.MasterData.Entities.Pump Get(TransactionManager transactionManager, BesAsm.MasterData.Entities.PumpKey key, int start, int pageLength)
		{
			return GetByPumpId(transactionManager, key.PumpId, start, pageLength);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key PK_PUMPS index.
		/// </summary>
		/// <param name="_pumpId">Primary key</param>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.Pump"/> class.</returns>
		public BesAsm.MasterData.Entities.Pump GetByPumpId(System.Int32 _pumpId)
		{
			int count = -1;
			return GetByPumpId(null,_pumpId, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PUMPS index.
		/// </summary>
		/// <param name="_pumpId">Primary key</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.Pump"/> class.</returns>
		public BesAsm.MasterData.Entities.Pump GetByPumpId(System.Int32 _pumpId, int start, int pageLength)
		{
			int count = -1;
			return GetByPumpId(null, _pumpId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PUMPS index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_pumpId">Primary key</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.Pump"/> class.</returns>
		public BesAsm.MasterData.Entities.Pump GetByPumpId(TransactionManager transactionManager, System.Int32 _pumpId)
		{
			int count = -1;
			return GetByPumpId(transactionManager, _pumpId, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PUMPS index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_pumpId">Primary key</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.Pump"/> class.</returns>
		public BesAsm.MasterData.Entities.Pump GetByPumpId(TransactionManager transactionManager, System.Int32 _pumpId, int start, int pageLength)
		{
			int count = -1;
			return GetByPumpId(transactionManager, _pumpId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PUMPS index.
		/// </summary>
		/// <param name="_pumpId">Primary key</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.Pump"/> class.</returns>
		public BesAsm.MasterData.Entities.Pump GetByPumpId(System.Int32 _pumpId, int start, int pageLength, out int count)
		{
			return GetByPumpId(null, _pumpId, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PUMPS index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_pumpId">Primary key</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.Pump"/> class.</returns>
		public abstract BesAsm.MasterData.Entities.Pump GetByPumpId(TransactionManager transactionManager, System.Int32 _pumpId, int start, int pageLength, out int count);
						
		#endregion "Get By Index Functions"
	
		#region Custom Methods
		
		
		#endregion

		#region Helper Functions	
		
		/// <summary>
		/// Fill a TList&lt;Pump&gt; From a DataReader.
		/// </summary>
		/// <param name="reader">Datareader</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">number of rows.</param>
		/// <returns>a <see cref="TList&lt;Pump&gt;"/></returns>
		public static TList<Pump> Fill(IDataReader reader, TList<Pump> rows, int start, int pageLength)
		{
			NetTiersProvider currentProvider = DataRepository.Provider;
            bool useEntityFactory = currentProvider.UseEntityFactory;
            bool enableEntityTracking = currentProvider.EnableEntityTracking;
            LoadPolicy currentLoadPolicy = currentProvider.CurrentLoadPolicy;
			Type entityCreationFactoryType = currentProvider.EntityCreationalFactoryType;
			
			// advance to the starting row
			for (int i = 0; i < start; i++)
			{
				if (!reader.Read())
				return rows; // not enough rows, just return
			}
			for (int i = 0; i < pageLength; i++)
			{
				if (!reader.Read())
					break; // we are done
					
				string key = null;
				
				BesAsm.MasterData.Entities.Pump c = null;
				if (useEntityFactory)
				{
					key = new System.Text.StringBuilder("Pump")
					.Append("|").Append((System.Int32)reader[((int)PumpColumn.PumpId - 1)]).ToString();
					c = EntityManager.LocateOrCreate<Pump>(
					key.ToString(), // EntityTrackingKey
					"Pump",  //Creational Type
					entityCreationFactoryType,  //Factory used to create entity
					enableEntityTracking); // Track this entity?
				}
				else
				{
					c = new BesAsm.MasterData.Entities.Pump();
				}
				
				if (!enableEntityTracking ||
					c.EntityState == EntityState.Added ||
					(enableEntityTracking &&
					
						(
							(currentLoadPolicy == LoadPolicy.PreserveChanges && c.EntityState == EntityState.Unchanged) ||
							(currentLoadPolicy == LoadPolicy.DiscardChanges && c.EntityState != EntityState.Unchanged)
						)
					))
				{
					c.SuppressEntityEvents = true;
					c.PumpId = (System.Int32)reader[((int)PumpColumn.PumpId - 1)];
					c.OriginalPumpId = c.PumpId;
					c.PumpName = (reader.IsDBNull(((int)PumpColumn.PumpName - 1)))?null:(System.String)reader[((int)PumpColumn.PumpName - 1)];
					c.UsNodeId = (System.Int32)reader[((int)PumpColumn.UsNodeId - 1)];
					c.DsNodeId = (reader.IsDBNull(((int)PumpColumn.DsNodeId - 1)))?null:(System.Int32?)reader[((int)PumpColumn.DsNodeId - 1)];
					c.LinkId = (reader.IsDBNull(((int)PumpColumn.LinkId - 1)))?null:(System.Int32?)reader[((int)PumpColumn.LinkId - 1)];
					c.PumpType = (System.Int32)reader[((int)PumpColumn.PumpType - 1)];
					c.InitialDepth = (reader.IsDBNull(((int)PumpColumn.InitialDepth - 1)))?null:(System.Decimal?)reader[((int)PumpColumn.InitialDepth - 1)];
					c.OnElevation = (System.Decimal)reader[((int)PumpColumn.OnElevation - 1)];
					c.OffElevation = (System.Decimal)reader[((int)PumpColumn.OffElevation - 1)];
					c.WetwellVolume = (reader.IsDBNull(((int)PumpColumn.WetwellVolume - 1)))?null:(System.Decimal?)reader[((int)PumpColumn.WetwellVolume - 1)];
					c.EditedBy = (System.String)reader[((int)PumpColumn.EditedBy - 1)];
					c.EditReason = (System.String)reader[((int)PumpColumn.EditReason - 1)];
					c.Status = (System.String)reader[((int)PumpColumn.Status - 1)];
					c.AppendDate = (System.DateTime)reader[((int)PumpColumn.AppendDate - 1)];
					c.EditDate = (reader.IsDBNull(((int)PumpColumn.EditDate - 1)))?null:(System.DateTime?)reader[((int)PumpColumn.EditDate - 1)];
					c.EntityTrackingKey = key;
					c.AcceptChanges();
					c.SuppressEntityEvents = false;
				}
				rows.Add(c);
			}
		return rows;
		}		
		/// <summary>
		/// Refreshes the <see cref="BesAsm.MasterData.Entities.Pump"/> object from the <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to read from.</param>
		/// <param name="entity">The <see cref="BesAsm.MasterData.Entities.Pump"/> object to refresh.</param>
		public static void RefreshEntity(IDataReader reader, BesAsm.MasterData.Entities.Pump entity)
		{
			if (!reader.Read()) return;
			
			entity.PumpId = (System.Int32)reader[((int)PumpColumn.PumpId - 1)];
			entity.OriginalPumpId = (System.Int32)reader["pump_id"];
			entity.PumpName = (reader.IsDBNull(((int)PumpColumn.PumpName - 1)))?null:(System.String)reader[((int)PumpColumn.PumpName - 1)];
			entity.UsNodeId = (System.Int32)reader[((int)PumpColumn.UsNodeId - 1)];
			entity.DsNodeId = (reader.IsDBNull(((int)PumpColumn.DsNodeId - 1)))?null:(System.Int32?)reader[((int)PumpColumn.DsNodeId - 1)];
			entity.LinkId = (reader.IsDBNull(((int)PumpColumn.LinkId - 1)))?null:(System.Int32?)reader[((int)PumpColumn.LinkId - 1)];
			entity.PumpType = (System.Int32)reader[((int)PumpColumn.PumpType - 1)];
			entity.InitialDepth = (reader.IsDBNull(((int)PumpColumn.InitialDepth - 1)))?null:(System.Decimal?)reader[((int)PumpColumn.InitialDepth - 1)];
			entity.OnElevation = (System.Decimal)reader[((int)PumpColumn.OnElevation - 1)];
			entity.OffElevation = (System.Decimal)reader[((int)PumpColumn.OffElevation - 1)];
			entity.WetwellVolume = (reader.IsDBNull(((int)PumpColumn.WetwellVolume - 1)))?null:(System.Decimal?)reader[((int)PumpColumn.WetwellVolume - 1)];
			entity.EditedBy = (System.String)reader[((int)PumpColumn.EditedBy - 1)];
			entity.EditReason = (System.String)reader[((int)PumpColumn.EditReason - 1)];
			entity.Status = (System.String)reader[((int)PumpColumn.Status - 1)];
			entity.AppendDate = (System.DateTime)reader[((int)PumpColumn.AppendDate - 1)];
			entity.EditDate = (reader.IsDBNull(((int)PumpColumn.EditDate - 1)))?null:(System.DateTime?)reader[((int)PumpColumn.EditDate - 1)];
			entity.AcceptChanges();
		}
		
		/// <summary>
		/// Refreshes the <see cref="BesAsm.MasterData.Entities.Pump"/> object from the <see cref="DataSet"/>.
		/// </summary>
		/// <param name="dataSet">The <see cref="DataSet"/> to read from.</param>
		/// <param name="entity">The <see cref="BesAsm.MasterData.Entities.Pump"/> object.</param>
		public static void RefreshEntity(DataSet dataSet, BesAsm.MasterData.Entities.Pump entity)
		{
			DataRow dataRow = dataSet.Tables[0].Rows[0];
			
			entity.PumpId = (System.Int32)dataRow["pump_id"];
			entity.OriginalPumpId = (System.Int32)dataRow["pump_id"];
			entity.PumpName = Convert.IsDBNull(dataRow["pump_name"]) ? null : (System.String)dataRow["pump_name"];
			entity.UsNodeId = (System.Int32)dataRow["us_node_id"];
			entity.DsNodeId = Convert.IsDBNull(dataRow["ds_node_id"]) ? null : (System.Int32?)dataRow["ds_node_id"];
			entity.LinkId = Convert.IsDBNull(dataRow["link_id"]) ? null : (System.Int32?)dataRow["link_id"];
			entity.PumpType = (System.Int32)dataRow["pump_type"];
			entity.InitialDepth = Convert.IsDBNull(dataRow["initial_depth"]) ? null : (System.Decimal?)dataRow["initial_depth"];
			entity.OnElevation = (System.Decimal)dataRow["on_elevation"];
			entity.OffElevation = (System.Decimal)dataRow["off_elevation"];
			entity.WetwellVolume = Convert.IsDBNull(dataRow["wetwell_volume"]) ? null : (System.Decimal?)dataRow["wetwell_volume"];
			entity.EditedBy = (System.String)dataRow["edited_by"];
			entity.EditReason = (System.String)dataRow["edit_reason"];
			entity.Status = (System.String)dataRow["status"];
			entity.AppendDate = (System.DateTime)dataRow["append_date"];
			entity.EditDate = Convert.IsDBNull(dataRow["edit_date"]) ? null : (System.DateTime?)dataRow["edit_date"];
			entity.AcceptChanges();
		}
		#endregion 
		
		#region DeepLoad Methods
		/// <summary>
		/// Deep Loads the <see cref="IEntity"/> object with criteria based of the child 
		/// property collections only N Levels Deep based on the <see cref="DeepLoadType"/>.
		/// </summary>
		/// <remarks>
		/// Use this method with caution as it is possible to DeepLoad with Recursion and traverse an entire object graph.
		/// </remarks>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">The <see cref="BesAsm.MasterData.Entities.Pump"/> object to load.</param>
		/// <param name="deep">Boolean. A flag that indicates whether to recursively save all Property Collection that are descendants of this instance. If True, saves the complete object graph below this object. If False, saves this object only. </param>
		/// <param name="deepLoadType">DeepLoadType Enumeration to Include/Exclude object property collections from Load.</param>
		/// <param name="childTypes">BesAsm.MasterData.Entities.Pump Property Collection Type Array To Include or Exclude from Load</param>
		/// <param name="innerList">A collection of child types for easy access.</param>
	    /// <exception cref="ArgumentNullException">entity or childTypes is null.</exception>
	    /// <exception cref="ArgumentException">deepLoadType has invalid value.</exception>
		public override void DeepLoad(TransactionManager transactionManager, BesAsm.MasterData.Entities.Pump entity, bool deep, DeepLoadType deepLoadType, System.Type[] childTypes, DeepSession innerList)
		{
			if(entity == null)
				return;

			#region LinkIdSource	
			if (CanDeepLoad(entity, "Link|LinkIdSource", deepLoadType, innerList) 
				&& entity.LinkIdSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = (entity.LinkId ?? (int)0);
				Link tmpEntity = EntityManager.LocateEntity<Link>(EntityLocator.ConstructKeyFromPkItems(typeof(Link), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.LinkIdSource = tmpEntity;
				else
					entity.LinkIdSource = DataRepository.LinkProvider.GetByLinkId(transactionManager, (entity.LinkId ?? (int)0));		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'LinkIdSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.LinkIdSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.LinkProvider.DeepLoad(transactionManager, entity.LinkIdSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion LinkIdSource

			#region DsNodeIdSource	
			if (CanDeepLoad(entity, "Node|DsNodeIdSource", deepLoadType, innerList) 
				&& entity.DsNodeIdSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = (entity.DsNodeId ?? (int)0);
				Node tmpEntity = EntityManager.LocateEntity<Node>(EntityLocator.ConstructKeyFromPkItems(typeof(Node), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.DsNodeIdSource = tmpEntity;
				else
					entity.DsNodeIdSource = DataRepository.NodeProvider.GetByNodeId(transactionManager, (entity.DsNodeId ?? (int)0));		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'DsNodeIdSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.DsNodeIdSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.NodeProvider.DeepLoad(transactionManager, entity.DsNodeIdSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion DsNodeIdSource

			#region UsNodeIdSource	
			if (CanDeepLoad(entity, "Node|UsNodeIdSource", deepLoadType, innerList) 
				&& entity.UsNodeIdSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.UsNodeId;
				Node tmpEntity = EntityManager.LocateEntity<Node>(EntityLocator.ConstructKeyFromPkItems(typeof(Node), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.UsNodeIdSource = tmpEntity;
				else
					entity.UsNodeIdSource = DataRepository.NodeProvider.GetByNodeId(transactionManager, entity.UsNodeId);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'UsNodeIdSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.UsNodeIdSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.NodeProvider.DeepLoad(transactionManager, entity.UsNodeIdSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion UsNodeIdSource

			#region PumpTypeSource	
			if (CanDeepLoad(entity, "PumpType|PumpTypeSource", deepLoadType, innerList) 
				&& entity.PumpTypeSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.PumpType;
				PumpType tmpEntity = EntityManager.LocateEntity<PumpType>(EntityLocator.ConstructKeyFromPkItems(typeof(PumpType), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.PumpTypeSource = tmpEntity;
				else
					entity.PumpTypeSource = DataRepository.PumpTypeProvider.GetByPumpTypeId(transactionManager, entity.PumpType);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'PumpTypeSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.PumpTypeSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.PumpTypeProvider.DeepLoad(transactionManager, entity.PumpTypeSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion PumpTypeSource

			#region StatusSource	
			if (CanDeepLoad(entity, "Status|StatusSource", deepLoadType, innerList) 
				&& entity.StatusSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.Status;
				Status tmpEntity = EntityManager.LocateEntity<Status>(EntityLocator.ConstructKeyFromPkItems(typeof(Status), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.StatusSource = tmpEntity;
				else
					entity.StatusSource = DataRepository.StatusProvider.GetByStatusId(transactionManager, entity.Status);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'StatusSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.StatusSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.StatusProvider.DeepLoad(transactionManager, entity.StatusSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion StatusSource
			
			//used to hold DeepLoad method delegates and fire after all the local children have been loaded.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();
			// Deep load child collections  - Call GetByPumpId methods when available
			
			#region PumpCurveCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<PumpCurve>|PumpCurveCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'PumpCurveCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.PumpCurveCollection = DataRepository.PumpCurveProvider.GetByPumpId(transactionManager, entity.PumpId);

				if (deep && entity.PumpCurveCollection.Count > 0)
				{
					deepHandles.Add("PumpCurveCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<PumpCurve>) DataRepository.PumpCurveProvider.DeepLoad,
						new object[] { transactionManager, entity.PumpCurveCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			//Fire all DeepLoad Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			deepHandles = null;
		}
		
		#endregion 
		
		#region DeepSave Methods

		/// <summary>
		/// Deep Save the entire object graph of the BesAsm.MasterData.Entities.Pump object with criteria based of the child 
		/// Type property array and DeepSaveType.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="entity">BesAsm.MasterData.Entities.Pump instance</param>
		/// <param name="deepSaveType">DeepSaveType Enumeration to Include/Exclude object property collections from Save.</param>
		/// <param name="childTypes">BesAsm.MasterData.Entities.Pump Property Collection Type Array To Include or Exclude from Save</param>
		/// <param name="innerList">A Hashtable of child types for easy access.</param>
		public override bool DeepSave(TransactionManager transactionManager, BesAsm.MasterData.Entities.Pump entity, DeepSaveType deepSaveType, System.Type[] childTypes, DeepSession innerList)
		{	
			if (entity == null)
				return false;
							
			#region Composite Parent Properties
			//Save Source Composite Properties, however, don't call deep save on them.  
			//So they only get saved a single level deep.
			
			#region LinkIdSource
			if (CanDeepSave(entity, "Link|LinkIdSource", deepSaveType, innerList) 
				&& entity.LinkIdSource != null)
			{
				DataRepository.LinkProvider.Save(transactionManager, entity.LinkIdSource);
				entity.LinkId = entity.LinkIdSource.LinkId;
			}
			#endregion 
			
			#region DsNodeIdSource
			if (CanDeepSave(entity, "Node|DsNodeIdSource", deepSaveType, innerList) 
				&& entity.DsNodeIdSource != null)
			{
				DataRepository.NodeProvider.Save(transactionManager, entity.DsNodeIdSource);
				entity.DsNodeId = entity.DsNodeIdSource.NodeId;
			}
			#endregion 
			
			#region UsNodeIdSource
			if (CanDeepSave(entity, "Node|UsNodeIdSource", deepSaveType, innerList) 
				&& entity.UsNodeIdSource != null)
			{
				DataRepository.NodeProvider.Save(transactionManager, entity.UsNodeIdSource);
				entity.UsNodeId = entity.UsNodeIdSource.NodeId;
			}
			#endregion 
			
			#region PumpTypeSource
			if (CanDeepSave(entity, "PumpType|PumpTypeSource", deepSaveType, innerList) 
				&& entity.PumpTypeSource != null)
			{
				DataRepository.PumpTypeProvider.Save(transactionManager, entity.PumpTypeSource);
				entity.PumpType = entity.PumpTypeSource.PumpTypeId;
			}
			#endregion 
			
			#region StatusSource
			if (CanDeepSave(entity, "Status|StatusSource", deepSaveType, innerList) 
				&& entity.StatusSource != null)
			{
				DataRepository.StatusProvider.Save(transactionManager, entity.StatusSource);
				entity.Status = entity.StatusSource.StatusId;
			}
			#endregion 
			#endregion Composite Parent Properties

			// Save Root Entity through Provider
			if (!entity.IsDeleted)
				this.Save(transactionManager, entity);
			
			//used to hold DeepSave method delegates and fire after all the local children have been saved.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();
	
			#region List<PumpCurve>
				if (CanDeepSave(entity.PumpCurveCollection, "List<PumpCurve>|PumpCurveCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(PumpCurve child in entity.PumpCurveCollection)
					{
						if(child.PumpIdSource != null)
						{
							child.PumpId = child.PumpIdSource.PumpId;
						}
						else
						{
							child.PumpId = entity.PumpId;
						}

					}

					if (entity.PumpCurveCollection.Count > 0 || entity.PumpCurveCollection.DeletedItems.Count > 0)
					{
						//DataRepository.PumpCurveProvider.Save(transactionManager, entity.PumpCurveCollection);
						
						deepHandles.Add("PumpCurveCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< PumpCurve >) DataRepository.PumpCurveProvider.DeepSave,
							new object[] { transactionManager, entity.PumpCurveCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
			//Fire all DeepSave Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			
			// Save Root Entity through Provider, if not already saved in delete mode
			if (entity.IsDeleted)
				this.Save(transactionManager, entity);
				

			deepHandles = null;
						
			return true;
		}
		#endregion
	} // end class
	
	#region PumpChildEntityTypes
	
	///<summary>
	/// Enumeration used to expose the different child entity types 
	/// for child properties in <c>BesAsm.MasterData.Entities.Pump</c>
	///</summary>
	public enum PumpChildEntityTypes
	{
		
		///<summary>
		/// Composite Property for <c>Link</c> at LinkIdSource
		///</summary>
		[ChildEntityType(typeof(Link))]
		Link,
			
		///<summary>
		/// Composite Property for <c>Node</c> at DsNodeIdSource
		///</summary>
		[ChildEntityType(typeof(Node))]
		Node,
			
		///<summary>
		/// Composite Property for <c>PumpType</c> at PumpTypeSource
		///</summary>
		[ChildEntityType(typeof(PumpType))]
		PumpType,
			
		///<summary>
		/// Composite Property for <c>Status</c> at StatusSource
		///</summary>
		[ChildEntityType(typeof(Status))]
		Status,
	
		///<summary>
		/// Collection of <c>Pump</c> as OneToMany for PumpCurveCollection
		///</summary>
		[ChildEntityType(typeof(TList<PumpCurve>))]
		PumpCurveCollection,
	}
	
	#endregion PumpChildEntityTypes
	
	#region PumpFilterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="SqlFilterBuilder&lt;PumpColumn&gt;"/> class
	/// that is used exclusively with a <see cref="Pump"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class PumpFilterBuilder : SqlFilterBuilder<PumpColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the PumpFilterBuilder class.
		/// </summary>
		public PumpFilterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the PumpFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public PumpFilterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the PumpFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public PumpFilterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion PumpFilterBuilder
	
	#region PumpParameterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="ParameterizedSqlFilterBuilder&lt;PumpColumn&gt;"/> class
	/// that is used exclusively with a <see cref="Pump"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class PumpParameterBuilder : ParameterizedSqlFilterBuilder<PumpColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the PumpParameterBuilder class.
		/// </summary>
		public PumpParameterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the PumpParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public PumpParameterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the PumpParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public PumpParameterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion PumpParameterBuilder
	
	#region PumpSortBuilder
    
    /// <summary>
    /// A strongly-typed instance of the <see cref="SqlSortBuilder&lt;PumpColumn&gt;"/> class
	/// that is used exclusively with a <see cref="Pump"/> object.
    /// </summary>
    [CLSCompliant(true)]
    public class PumpSortBuilder : SqlSortBuilder<PumpColumn>
    {
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the PumpSqlSortBuilder class.
		/// </summary>
		public PumpSortBuilder() : base() { }

		#endregion Constructors

    }    
    #endregion PumpSortBuilder
	
} // end namespace
